<div class="layui-fluid layui-anim website-anim-up" id="website-class-apply-member-add" lay-title="课题组成员新增">
    <div class="layui-row layui-col-space8 website-container">
        <div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
            <form class="layui-form" lay-filter="class-apply-member-add-form" id="class-apply-member-add-form">
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="website-hide">
                            <label class="layui-form-label">id</label>
                            <div class="layui-input-block">
                                <input type="text" name="memberId" autocomplete="off" class="layui-input">
                                <input type="text" name="declareId" autocomplete="off" class="layui-input">
                                <input type="text" name="memberType" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <!-- 基本信息-->
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">姓名</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" lay-verify="required|range" maxlength="20"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">性别</label>
                            <div class="layui-input-block">
                                <select name="sexTypeCode" lay-verify="required" lay-filter="sexTypeCode">
                                    <option value="">请选择</option>
                                    <option
                                            th:each="item : ${sex}"
                                            th:value="${item.code}" th:text="${item.name}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">出生年月</label>
                            <div class="layui-input-block">
                                <input type="text" name="birthday" lay-verify="required" id="member-add-birthday"
                                       autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">职称级别</label>
                            <div class="layui-input-block">
                                <select name="titleTypeCode" lay-verify="required"
                                        lay-filter="titleTypeCode">
                                    <option value="">请选择</option>
                                    <option
                                            th:each="item : ${titleTypeCode}"
                                            th:value="${item.code}" th:text="${item.name}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">职称</label>
                            <div class="layui-input-block">
                                <input type="text" name="professionCode" lay-verify="required" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">联系电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="mobile" lay-verify="required|mobile" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">职务</label>
                            <div class="layui-input-block">
                                <select name="positionTypeCode" lay-verify="required"
                                        lay-filter="positionTypeCode">
                                    <option value="">请选择</option>
                                    <option
                                            th:each="item : ${positionTypeCode}"
                                            th:value="${item.code}" th:text="${item.name}">
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">研究领域</label>
                            <div class="layui-input-block">
                                <input type="text" name="field" lay-verify="required" autocomplete="off" maxlength="50"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">最终学位</label>
                            <div class="layui-input-block">
                                <select name="degreeTypeCode" lay-verify="required"
                                        lay-filter="degreeTypeCode">
                                    <option value="">请选择</option>
                                    <option
                                            th:each="item : ${degree}"
                                            th:value="${item.code}" th:text="${item.name}">
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">工作单位</label>
                            <div class="layui-input-block">
                                <input type="text" name="companyAddress" lay-verify="required" maxlength="50"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">证件类型</label>
                            <div class="layui-input-block">
                                <select id="identityTypeCode" name="identityTypeCode"
                                        lay-filter="identityTypeCode"
                                        lay-verify="required">
                                    <option value="">请选择</option>
                                    <option
                                            th:each="item : ${identityTypeCode}"
                                            th:value="${item.code}" th:text="${item.name}">
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">证件号码</label>
                            <div class="layui-input-block">
                                <input type="text" id="identity" name="identity" lay-verify="required|identity"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>

                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                            <label class="layui-form-label website-form-item-require">电子邮箱</label>
                            <div class="layui-input-block">
                                <input type="text" name="email" lay-verify="required|email" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item website-hide">
                    <button type="button" class="layui-btn" lay-submit lay-filter="class-apply-member-add-form-submit"
                            id="submit">保存
                    </button>
                    <button type="reset" class="layui-btn" id="reset">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script data-th-inline="none" type="text/javascript">
    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'website', 'table', 'validate'], function () {
        let $ = layui.jquery,
            laydate = layui.laydate,
            website = layui.website,
            form = layui.form,
            validate = layui.validate,
            formSelects = layui.formSelects,
            dropdown = layui.dropdown,
            table = layui.table,
            $view = $('#website-class-apply-member-add'),
            $submit = $('#submit');
        // 重新渲染 form否则不会显示下拉框
        form.render();

        form.verify(validate);
        //初始化时间
        laydate.render({
            elem: '#member-add-birthday' //指定元素
            , type: 'date',
            trigger: 'click',
        });

        form.on('select(identityTypeCode)', function (data) {
            if ("zjlx_sfz" === data.value) {
                // lay-verify="required|identity"
                $('#identity')[0].setAttribute('lay-verify', "required|identity")
            } else if (data.value) {
                $('#identity')[0].setAttribute('lay-verify', "required")
            }
        });

    })


</script>